package com.aboverock.module.system.domain;

import com.aboverock.common.validator.NotContains;
import com.aboverock.core.orm.domain.StringBaseEntity;
import com.aboverock.module.system.constant.SystemConstants;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;

/**
 * <p>
 * 资源信息.
 * </p>
 *
 * @author Rock Wang
 * @since 2018-09-10
 */
@TableName("t_sys_resource")
@ApiModel(value = "Resource对象", description = "")
public class Resource extends StringBaseEntity {

    @ApiModelProperty(value = "资源名称")
    @NotBlank
    private String name;

    @ApiModelProperty(value = "前端资源code")
    @NotBlank
    @NotContains({ SystemConstants.RESOURCE_PERMISSION_CONNECTOR })
    @Length(min = 1, max = 64)
    private String code;

    @ApiModelProperty(value = "后端接口url")
    private String restUrls;

    @ApiModelProperty(value = "授权(多个用逗号分隔，如：user:list,user:create)")
    @Length(max = 128)
    private String permissions;

    @ApiModelProperty(value = "类型 0：菜单，1：按钮")
    private Integer type;

    @ApiModelProperty(value = "排序")
    private Long orderNo;

    @ApiModelProperty(value = "资源图标")
    @Length(max = 64)
    private String icon;

    @ApiModelProperty(value = "父菜单ID，一级菜单为NULL")
    private String parentId;

    @ApiModelProperty(value = "备注")
    @Length(max = 255)
    private String remark;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getRestUrls() {
        return restUrls;
    }

    public void setRestUrls(String restUrls) {
        this.restUrls = restUrls;
    }

    public String getPermissions() {
        return permissions;
    }

    public void setPermissions(String permissions) {
        this.permissions = permissions;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Long getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(Long orderNo) {
        this.orderNo = orderNo;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return "Resource{" +
        ", name=" + name +
        ", code=" + code +
        ", restUrls=" + restUrls +
        ", permissions=" + permissions +
        ", type=" + type +
        ", orderNo=" + orderNo +
        ", icon=" + icon +
        ", parentId=" + parentId +
        ", remark=" + remark +
        "}";
    }

}
